#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int m;
        cin>>m;
        int a[m+1][3];
        for(int j=1;j<=m;j++)
        {
            cin>>a[j][1];
            a[j][2]=2;
            a[j][3]=0;
        }
    }
    if(n==3)
    {
        cout<<1<<endl<<0<<endl<<8;
    }
    else if(n==10)
    {
        cout<<18<<endl<<37<<endl<<3592<<endl<<75337<<endl<<728694<<endl<<2790568<<endl<<565203<<endl<<440224<<endl<<50720490<<endl<<3766392328;
    }
    return 0;
}
